package com.yuhong.reggie.controller;

import com.yuhong.reggie.common.R;
import com.yuhong.reggie.entity.Orders;
import com.yuhong.reggie.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RequestMapping("/order")
@RestController
public class OrderController {
    @Autowired(required = false)
    private OrderService orderService;
    @RequestMapping("/submit")
    public R<String>  submit(@RequestBody Orders orders, HttpSession session){

        Long userId = (Long) session.getAttribute("user");

        orderService.addSvae(orders,userId);

        return R.success("下单成功");
    }
}
